package com.chain.qs.modules.biz.dp.handler;

import com.chain.qs.modules.biz.entity.EquipmentItemRecordLYUPSDev;
import com.chain.qs.modules.biz.service.EquipmentItemRecordLYUPSDevService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.Map;

/**
 * UPS
 */
//@Component("CAUPSDev")
public class LYUPSDev extends AbstractDPHandler {
    @Resource
    private EquipmentItemRecordLYUPSDevService equipmentItemRecordLYUPSDevService;

    public void saveData(Map<String, Object> params) {
        EquipmentItemRecordLYUPSDev entity = new EquipmentItemRecordLYUPSDev();
        entity.setOfficeCode(officeCode);
        entity.setSgroupId(sgroupId);
        entity.setGitemId(deviceId);
        entity.setInPw(params.get("in_pw") == null ? "" : params.get("in_pw").toString());
        entity.setOuPw(params.get("ou_pw") == null ? "" : params.get("ou_pw").toString());
        entity.setLoadRt(params.get("load_rt") == null ? "" : params.get("load_rt").toString());
        entity.setOuFreq(params.get("ou_freq") == null ? "" : params.get("ou_freq").toString());
        entity.setBtyVol(params.get("bty_vol") == null ? "" : params.get("bty_vol").toString());
        entity.setTemp(params.get("temp") == null ? "" : params.get("temp").toString());
        entity.setTimeStamp(new Timestamp(System.currentTimeMillis()));
        equipmentItemRecordLYUPSDevService.save(entity);
    }
}
